<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>抽取下载链接</title>
    <script>
        function test(source) {
            var protocol = document.getElementById("protocol").value;
            var suffix = document.getElementById("suffix").value;
            var reg = '"';
            if (protocol == null || protocol.trim().length == 0) {
                protocol = "ftp";
            }
            if (suffix == null || suffix.trim().length == 0) {
                suffix = "rmvb";
            }
            reg = reg + protocol + ":.*?\\." +suffix + '"';
            var translate = source.match(new RegExp(reg,"gi")) + "";
            var temp = translate.replace(new RegExp('"',"g"),'').replace(new RegExp('"',"g"),'');
            var result = temp.replace(new RegExp(",","g"),'<br/>');
            if (result != null && result != 'null') {
                document.getElementById("result").innerHTML = result;
            } else {
                alert("没匹配到指定搜索条件URL，请核对！！！");
                document.getElementById("result").innerHTML = "没匹配到指定搜索条件URL，请核对！！！";
            }
        }
        function clickButton() {
            test(document.getElementById("source").value);
        }
    </script>
</head>
<body>
<form>
    <h2>粘贴html源码，提取迅雷下载链接（默认提取ftp://开头，.rmvb结尾的URL）</h2>
    <h4>自定义协议（例如：http）：<input type="text" name="protocol" id="protocol"/></h4>
    <h4>自定义后缀（例如：mp4）：<input type="text" name="suffix" id="suffix"/></h4>
    粘贴html源码内容：<br/>
    <textarea name="source" id = "source" rows="20" cols="100"></textarea>
    <br/>
    <input type="button" name="click" id="click" value="提取下载链接" onclick="clickButton();" style="width: 150px;font-size: 18px;background: blanchedalmond"/>
    <br/>
    提取结果(复制到迅雷下载)：<br/>
    <div name="result" id="result"></div>
</form>
</body>
</html>